]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
windowManager: Update active workspace after inserting a new one
authorFlorian Müllner <fmuellner@gnome.org>
Thu, 15 Jan 2015 23:32:27 +0000 (00:32 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Fri, 16 Jan 2015 18:28:56 +0000 (19:28 +0100)
New workspaces are inserted by shifting all windows on workspaces
below the insertion position down. As a result, when the new
workspace is inserted before the active one, we end up with
the illusion of a workspace switch. Instead, activate the workspace
on which the windows from the active one ended up.

https://bugzilla.gnome.org/show_bug.cgi?id=665764

js/ui/windowManager.js

index b45037630752208cf9ebca56f06f8714b1aea88e..88acd459236a19002be390e0cb9ddca777ef6206 100644 (file)
@@ -913,6 +913,16 @@ const WindowManager = new Lang.Class({
                 return;
             window.change_workspace_by_index(index + 1, true);
         });
+
+        // If the new workspace was inserted before the active workspace,
+        // activate the workspace to which its windows went
+        let activeIndex = global.screen.get_active_workspace_index();
+        if (activeIndex >= pos) {
+            let newWs = global.screen.get_workspace_by_index(activeIndex + 1);
+            this._blockAnimations = true;
+            newWs.activate(global.get_current_time());
+            this._blockAnimations = false;
+        }
     },
 
 
@@ -945,7 +955,7 @@ const WindowManager = new Lang.Class({
     },
 
     _shouldAnimate: function() {
-        return !Main.overview.visible;
+        return !(Main.overview.visible || this._blockAnimations);
     },
 
     _shouldAnimateActor: function(actor, types) {